
gridGeneralChart = function(_chartConfig, _chartData){
	var _chart = $('#' + _chartConfig.chartid).highcharts();
	var _config = $.extend(true, {}, _chartConfig);
	
	if('undefined' != typeof _chart){
	    if (_chart.series.length) {
	    	for(;0 < _chart.series.length; ){
	    		_chart.series[0].remove();
	    	}
	    }
	}
	
	if(!$.isEmptyObject(_chartData)){
		if(undefined != _chartData.category){
			if(undefined != _chart){
				_chart.xAxis[0].setCategories(_chartData.category);
			}else{
				_chart.xAxis[0].setCategories(_chartData.category);
				/*
				while(undefined ==  _chart){
					if(undefined != _chart){
						_chart.xAxis[0].setCategories(_chartData.category);
					}
				}
				*/
				
			}
		}
		
		var dataCnt = 0;
		jQuery.each(_chartData.data, function(dkey, dval){
			if(null != dval){
				if(_chartData.category.length != dval.length){
					var _spaceSize = _chartData.category.length - dval.length;
					for(var _spaceCnt = 0; _spaceCnt <  _spaceSize; _spaceCnt++){
						dval.push(null);
					}
				}
				_config.config[dataCnt].data = dval;
				_config.config[dataCnt].name = dkey;
				_chart.addSeries(_config.config[dataCnt]);
				dataCnt++;	
			}
		});
	}
}

usingChartDateGrid = function(_chartConfig, _chartData){
	var _chart = $('#' + _chartConfig.chartid).highcharts();
	var _config = $.extend(true, {}, _chartConfig);
	
    if (_chart.series.length) {
    	for(;0 < _chart.series.length; ){
    		_chart.series[0].remove();
    	}
    }

	if(!$.isEmptyObject(_chartData)){
		var dataCnt = 0;
		jQuery.each(_chartData.data, function(dkey, dval){
			if(null != dval){
				if(_chartData.category.length != dval.length){
					var _spaceSize = _chartData.category.length - dval.length;
					for(var _spaceCnt = 0; _spaceCnt <  _spaceSize; _spaceCnt++){
						dval.push(null);
					}
				}
				_config.config[dataCnt].data = dval;
				_config.config[dataCnt].name = dkey;
				_chart.addSeries(_config.config[dataCnt]);
				dataCnt++;	
			}
		});
	}
}

distributionChart = function(_chartConfig, _chartData){
	var _chart = $('#' + _chartConfig.chartid).highcharts();
	var _config = $.extend(true, {}, _chartConfig);
	if (_chart.series.length) {
    	for(;0 < _chart.series.length; ){
    		_chart.series[0].remove();
    	}
    }
	
	if(undefined != _chartData.category){
		_chart.xAxis[0].setCategories(_chartData.category);
	}
	
	var dataCnt = 0;
	for(var _dataName in _chartData){
		_config.config[dataCnt].data = _chartData[_dataName];
		_config.config[dataCnt].name = _dataName;
		_chart.addSeries(_config.config[dataCnt]);
		dataCnt++;	
	}
}

setPointMarker = function(_chartdata, _series, _xaxisIndex, _symbolUrl){
	_chartdata.data[_series][_xaxisIndex] = {y:_chartdata.data[_series][_xaxisIndex], marker:{ symbol: _symbolUrl}};
}
